//
//  FDTitleView.m
//  FamousDoctorOnline
//
//  Created by wszyxc on 16/7/5.
//  Copyright © 2016年 wszyxc. All rights reserved.
//

#import "FDTitleView.h"

@implementation FDTitleView


- (instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        [self setupUI];
        
    }
    
    
    return self;
}

- (void)setupUI{
    
    
    self.backgroundColor = WHITE_COLOR;
    
    
    //添加绿色图标
    
    UIImageView *greenView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"yj"]];
    
    [self addSubview:greenView];
    
    [greenView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(self.mas_centerY);
        make.leading.offset(10);
        
    }];
    
    //添加标题
    UILabel *titleLabel = [self setupOneLabelWithTitle:@"名医通" testColor:[UIColor blackColor] fontSize:20];
    
    [self addSubview:titleLabel];
    
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.leading.equalTo(greenView.mas_trailing).offset(20);
        make.centerY.equalTo(self.mas_centerY);
        
    }];
    
}

/**
 *  添加一个label的快捷方法
 */
- (UILabel *)setupOneLabelWithTitle:(NSString *)title testColor:(UIColor *)color fontSize:(CGFloat)fontSize{
    
    UILabel *label = [[UILabel alloc]init];
    
    label.textColor = color;
    
    label.font = [UIFont systemFontOfSize:fontSize];
    
    label.text = title;
    
    return label;
    
}


@end
